#include<bits/stdc++.h>
using namespace std;
int main()
{
	double m, t;
	cin>>m>>t;
	cout<<fixed<<setprecision(1);
	if(t)
	{
		if(m >= 2000)
			cout<<m*0.8;
		else
			cout<<m*0.85;
	}
	else
	{
		if(1000 <= m && m < 2000)
			cout<<m*0.95;
		else if(2000 <= m && m <= 4000)
			cout<<m*0.9;
		else if(m > 4000)
			cout<<m*0.8;
		else
			cout<<m;
	}
	return 0;
}
